#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include<string>
#include "combine.hpp"
#if 0
int main(){
     umask(0);
    int n=mkfifo("ff",0666);
      if (n != 0)
    {
        std::cerr << "mkdir fifo error" << std::endl;
        return 1;
    }
      int x=open("ff",O_RDONLY);
      std::cout<<"open success"<<std::endl;//客户端也就是管道写端没有进入则一直堵塞
       if (x < 0)
    {
        std::cerr << "open fifo error" << std::endl;
        return 2;
    }
     while(1){
         char buff[1024]={0};
        int n= read(x,buff,sizeof(buff)-1);
      if(n>0) std:: cout<<"客户说:"<<buff<<std::endl;
      else if(n==0){
          std::cout<<"client exit"<<std::endl;
          break;
     }
     
     else {std::cout<<"read error"<<std::endl;}
     }
     int u=unlink("./ff");
     if(u==0) std::cout<<"成功删除管道"<<std::endl;
     else std::cout<<"unlink error"<<std::endl;
    
     close(x);
    

}
#endif

int main(){
  cnpipe cp(".","ff");
  oppipe op(".","ff");
  op.openr();
  op.pread();


}

